/*eslint-disable*/
function isValid(item,level){
    return item[`Radiu_Bear1_WING_A${level}`] !== 999999 &&
        item[`Radiu_Bear2_WING_A${level}`] !== 999999 &&
        item[`Radiu_Bear3_WING_A${level}`] !== 999999 &&
        item[`Radiu_Bear4_WING_A${level}`] !== 999999;
}
export function drawColis(item, lineLevel){
    var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    svgElement.setAttribute("id","coli")
    svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
    svgElement.setAttribute('viewBox', `0 0 200 200`);

    drawColi(item,7,svgElement,lineLevel);
    drawColi(item,10,svgElement,lineLevel);
    drawColi(item,12,svgElement,lineLevel);
    return svgElement;
}
export function drawColi(item,level,svgElement,lineLevel){
    let strokeWidth=(1.1/lineLevel).toFixed(1),fillOpacity=1/lineLevel;
    switch (lineLevel) {
        case 1:
            strokeWidth=2;
            break;
        case 2:
            strokeWidth=1.5;
            break;
        case 3:
            strokeWidth=1;
            break;
        case 4:
            strokeWidth=.7;
            break;
        case 5:
            strokeWidth=.35;
            break;
        case 6:
            strokeWidth=.2;
            break;
        case 7:
            strokeWidth=.1;
            break;
        case 8:
            strokeWidth=.05;
            break;
        case 9:
            strokeWidth=.03;
            break;
        case 10:
            strokeWidth=.01;
            break;
        case 11:
            strokeWidth=.01;
            break;
        case 12:
            strokeWidth=.01;
            break;
    }
    const radius={
        northEast: item[`Radiu_Bear1_WING_A${level}`] === 999999 ? 0 : item[`Radiu_Bear1_WING_A${level}`]/11.3, //东北
        southEast: item[`Radiu_Bear2_WING_A${level}`] === 999999 ? 0 : item[`Radiu_Bear2_WING_A${level}`]/11.3, //东南
        southWest: item[`Radiu_Bear3_WING_A${level}`] === 999999 ? 0 : item[`Radiu_Bear3_WING_A${level}`]/11.3, //西南
        northWest: item[`Radiu_Bear4_WING_A${level}`] === 999999 ? 0 : item[`Radiu_Bear3_WING_A${level}`]/11.3, //西北
    };
    const style={
        s7:`fill:#61e412;stroke:#81ff12;stroke-opacity:1;fill-opacity:${fillOpacity*1.1};stroke-width:${strokeWidth}`,
        s10:`fill:#ccce14;stroke:yellow;stroke-opacity:1;fill-opacity:${fillOpacity*1.2};stroke-width:${strokeWidth}`,
        s12:`fill:#de1414;stroke:red;stroke-opacity:1;fill-opacity:${fillOpacity*1.5};stroke-width:${strokeWidth}`,
    };

    svgElement.innerHTML+=`
        <path 
            d="M100,${100-radius.northWest} A ${radius.northWest},${radius.northWest} 0 0 0 ${100-radius.northWest},100 L ${100-radius.southWest},100 A ${radius.southWest},${radius.southWest} 0 0 0 100,${100+radius.southWest} L 100,${100+radius.southEast} A ${radius.southEast},${radius.southEast} 0 0 0 ${100+radius.southEast},100 L ${100+radius.northEast},100 A ${radius.northEast},${radius.northEast} 0 0 0 100,${100-radius.northEast} z" 
            style=${style[`s${level}`]}
		/>
    `;
}